package com.sun.dream.fish.vo;

import com.sun.dream.fish.frontmodel.resources.DSFErrorMessage;
import com.sun.dream.fish.session.DsfThreadLocalHelper;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * Description:  响应对象
 * Created By ljl on 2023/11/24.
 */
@Data
@NoArgsConstructor
public class ResultVO<T> implements Serializable {
    private int code;
    private String message;
    private T data;

    public ResultVO(T data) {
        this.data = data;
        this.code = 0;
    }

    public ResultVO(T data, int code) {
        this.data = data;
        this.code = code;
        this.message = DSFErrorMessage.getInstance().getMessageByLocale(String.valueOf(code), DsfThreadLocalHelper.getDSFSession().getLocale());
    }

    public ResultVO(T data, int code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

}
